/**************************************************************
 *   File:	Vector4.cpp
 * Author:	Andrew Thorpe
 *  Brief:	Full-featured 4 component vector class
 **************************************************************/
#ifndef _FOSSIL_VECTOR4_H
#define _FOSSIL_VECTOR4_H

#include <iostream>

namespace Fossil
{
	class Vector4
	{
	public:
		Vector4(void):m_x(0.0f), m_y(0.0f), m_z(0.0f), m_w(1.0f) {}
		Vector4(float x, float y, float z, float w = 1.0f):m_x(x), m_y(y), m_z(z), m_w(w) {}
		Vector4(float val[4]):m_x(val[0]), m_y(val[1]), m_z(val[2]), m_w(val[3]) {}
		Vector4(const Vector4& rhs):m_x(rhs.m_x), m_y(rhs.m_y), m_z(rhs.m_z), m_w(rhs.m_w) {}
		~Vector4(void) {}

		inline Vector4&	operator =	(const Vector4& rhs);
			
		inline Vector4	operator +  (const Vector4& rhs) const;
		inline void		operator += (const Vector4& rhs);
		inline Vector4	operator +  (float rhs) const;
		inline void		operator += (float rhs);

		inline Vector4	operator -  (const Vector4& rhs) const;
		inline void		operator -= (const Vector4& rhs);
		inline Vector4	operator -  (float rhs) const;
		inline void		operator -= (float rhs);

		inline Vector4	operator /  (const Vector4& rhs) const;
		inline void		operator /= (const Vector4& rhs);
		inline Vector4	operator /  (float rhs) const;
		inline void		operator /= (float rhs);

		inline Vector4	operator *  (const Vector4& rhs) const;
		inline void		operator *= (const Vector4& rhs);
		inline Vector4	operator *  (float rhs) const;
		inline void		operator *= (float rhs);

		inline bool		operator == (const Vector4& rhs) const;
		inline bool		operator != (const Vector4& rhs) const;

		inline float	Dot(const Vector4& rhs) const;
		inline Vector4	Cross(const Vector4& rhs) const;
		inline float	Length() const;
		inline float	SquaredLength() const;
		inline void		Normalise();
		inline Vector4	Normalised() const;

		static Vector4	UnitX();
		static Vector4	UnitY();
		static Vector4	UnitZ();
		static Vector4	Zero();

		friend  std::ostream& operator<<(std::ostream& output, const Vector4& rhs)
		{
			output << rhs.m_x << "\t" << rhs.m_y << "\t" << rhs.m_z << "\t" << rhs.m_w;
			return output;
		}

		float m_x, m_y, m_z, m_w;
	};

	 typedef Vector4 Vector;
	 typedef const Vector& ConstVectorRef;
};

#endif//_FOSSIL_VECTOR4_H
